<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>新增菜品分类</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_memberAdd.css">
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<script src="__PUBLIC__/Plugins/Datepicker/WdatePicker.js"></script>
</head>

<body>
	<div class="page_wraper">
		<div id="tab1_0" style="padding-left:8px;">
			<form id="form_ele">
				<table cellpadding="0" cellspacing="0" class="module_form">
					<tr>
						<td class="ele_title"><label for="title">请选择餐厅：<em>*</em></label></td>
						<td class="ele_content">
							<select name="restid" id="restSel" style="width:350px;">
								<option value="">请选择</option>
								<volist name="rest" id="vo">
									<option value="{$vo.id}">{$vo.title}({$vo.entitle})</option>
								</volist>
							</select>
						</td>
					</tr>
					<tr>
						<td class="ele_title"><label for="title">请选择上级分类：<em>*</em></label></td>
						<td class="ele_content">
							<select name="pid" id="shangji" style="width:350px;"></select>
						</td>
					</tr>
					<tr>
						<td class="ele_title"><label for="title">菜品分类中文名称：<em>*</em></label></td>
						<td class="ele_content">
							<input name="title" type="text" class="form_ele_text width_200">
						</td>
					</tr>
					<tr>
						<td class="ele_title"><label for="entitle">菜品分类英文名称：<em>*</em></label></td>
						<td class="ele_content">
							<input name="entitle" type="text" class="form_ele_text width_200">
						</td>
					</tr>
					<tr>
						<td class="ele_title"><label for="entitle">排序号：<em>*</em></label></td>
						<td class="ele_content">
							<input name="sort" type="text" value="0" class="form_ele_text width_200">
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	<div class="page_footer pdtd10">
		<input type="button" name="submit" value="提交数据"  class="form_ele_submit"/>
		<input type="reset"  name="reset"  value="清空数据"  class="form_ele_reset"/>
	</div>
</body>
<script type="text/javascript">
	//弹出窗口全局变量
	var api = frameElement.api, W = api.opener;

	$(function(){
		//重置
		$('.form_ele_reset').on('click',function(){
			frameApi.close(); //关闭当前窗口
		});
		
		//根据门店id获取菜品分类
		$("#restSel").on("change",function(){
			var restid = $(this).val();
			$.get("{:U('Product/sortByOutlet')}",{restid:restid},function(html){
				$("#shangji").html(html);
			});
		});
		
		//提交
		$('.form_ele_submit').on('click',function(){
			
			var tipsObj = windowApi.lhgdialog.tips('正在提交数据...',10,etIcon.loading);
			
			//通过Ajax提交表单
			var postData = {};
			postData = $("#form_ele").serialize();
			$.post("{:U('Product/sortAdd')}", postData , function(data){
				
				if(data.status==1){
					windowApi.lhgdialog.tips('数据提交成功！');
					var obj = windowApi.lhgdialog.list['Product_sort'];
					obj.reload(obj);
					frameApi.close(); //关闭当前窗口
				}else{
					windowApi.lhgdialog.alert(data.info);
				}
			}, "json");
					
		});
	});
</script>
</html>
